import os
def sta(dir):
    size = 0
    dist = os.listdir(dir)
    for i in dist:
        file = os.path.join(dir,i)
        if os.path.isfile(file):
            a = os.path.getsize(file)
            size = size + a
        elif os.path.isdir(file):
            size+=sta(file)
    return size

print(sta('D:/wj/lcr'))  #输入要统计的目录路径
